package com.study.design.pattern.pattern.behavioral.chainofresponsibility;

/**
 * @Author: gongsl
 * @Date: 2025-03-25 23:48
 */
public class ResponsibilityChainTest {
    public static void main(String[] args) {
        LeaveHandler supervisor = new Supervisor();
        LeaveHandler manager = new Manager();
        LeaveHandler director = new Director();

        // 组装责任链
        supervisor.setNextHandler(manager);
        manager.setNextHandler(director);

        // 发起请假请求
        supervisor.handleRequest(2);  // 主管批准
        supervisor.handleRequest(5);  // 经理批准
        supervisor.handleRequest(10); // 总监批准
        supervisor.handleRequest(20); // 不予批准
    }
}
